package com.atguigu.oss.controller;

import com.atguigu.commonutils.R;
import com.atguigu.oss.service.OssService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@CrossOrigin
@RestController
@Api
@RequestMapping("/eduoss/fileoss")
public class OssController {


    @Autowired
    private OssService ossService;

    @ApiOperation(value = "上传文件")
    @PostMapping
    public R uploadFile(@RequestPart("file")   MultipartFile file){

        String url = ossService.upLoadFile(file);

        return R.ok().data(url);

    }


}
